$(function () {

  $.ajax({
    url: '/admin/data/info',
    success: res => {
      $('.total em').text(res.totalArticle)
      $('.scolor01 em').text(res.dayArticle)
      $('.scolor02 em').text(res.totalComment)
      $('.scolor03 em').text(res.dayComment)
    }
  })


  $.ajax({
    url: '/admin/data/article',
    success: res => {
      let date = res.date.map(item => item.date)
      let data = res.date.map(item => item.count);
      loadEchars({ date, data })
    }

  })

  $.ajax({
    url: '/admin/data/category',
    success: res => {
      let data = res.date.map(item => item.name)
      let total = res.date.map(item => item.articles)
      bingtu(total, data)
    }
  })

  $.ajax({
    url: '/admin/data/visit',
    success: res => {
      let data = []
      let total = []
      for (const key in res.data) {
        data.push(key)
        total.push(res.data[key])
      }
      ZZ(data,total) 
    }
  })
})